
# -*- coding:utf-8 -*-
# Create your models here.

from django.db import models

STATUS_CHOICES = (
        (1,'正常'),
        (0,'失效'),
    )

class Users(models.Model):
    
    username=models.CharField('帐号',max_length=20)
    password=models.CharField('密码',max_length=20)
    times=models.DateTimeField('注册时间',auto_now=True,)
    nickname=models.CharField('昵称',max_length=20,null =True, blank=True,)
    status=models.IntegerField('用户状态',default=1,choices=STATUS_CHOICES)
    class Meta:
        verbose_name = u'系统用户'
        verbose_name_plural = u'系统用户'
    def __unicode__(self):
        return  self.nickname 
    
    
class Power(models.Model):
    users = models.ForeignKey(Users,verbose_name='用户')
    status=models.IntegerField('VPN状态',default=1,choices=STATUS_CHOICES)
    class Meta:
        verbose_name = u'VPN权限'
        verbose_name_plural = u'VPN权限'
    def __unicode__(self):
        return  self.users.nickname